/*
 *
-10

11
10

10
11

11
10
 */
#include <iostream>
using namespace std;
class Integer{
	private:
		int i ;
	public:
		Integer(int m=0):i(m){}
		void print(void){
			cout << i << endl;
		}
		//相反数 -
		const Integer operator-(){
			return Integer(-i);
		}
		//前++ 成员函数方式实现
		Integer& operator++(){
			this->i ++;
			return *this;
		}
		//前-- 友元函数方式实现
		friend Integer& operator--(Integer& that){
			that.i --;
			return that;
		}
		//后++ 成员函数实现
		const Integer operator++(int){
			Integer c = *this;
			i++;
			return c;
		}
		//后-- 友元函数实现
		friend const Integer operator--(Integer& that, int){
			Integer c = that;
			that.i--;
			return c;
		}
};
int main(void){
	Integer a(10);
	//相反数
	Integer b = -a;
	b.print();

	//前缀自增减运算符重载
	(++a).print();
	(--a).print();

	//后缀自增运算符重载
	Integer c = a++;
	c.print();
	a.print();


	//后缀自增运算符重载
	Integer c1 = a--;
	c1.print();
	a.print();

	return 0;
}
